#include "llt_print_tcp.hh"

using namespace print_tcp;

void
print_tcp_AG::handler(lee::Event * ev)
{
  printHello(ev);
  pub_event4();
  if(check()) {
    //createPPF<userPPF::printer>("printIP");
    //addPpfAfter("ppf1", userPPF::myPpf::NORMAL, "printIP", userPPF::printer::NORMAL);
    //addPpfBefore("printIP", userPPF::printer::NORMAL,"eth0");
    deletePPFunction("printIP", userPPF::printer::NORMAL);
  }
  return;
}

void
print_tcp_AG::printHello(lee::Event * ev)
{
  std::cout << "Hello " << ev->getType() << std::endl;
  return;
}

bool
print_tcp_AG::check()
{
  Synchronized::Scope mutex(this);
  if(j < 100) {
    j++;
    return false;
  }
  else if(j == 100) {
    j++;
    return true;
  }
  else {
    return false;
  }
}
